<template>
    <!-- 热门推荐 -->
    <div class="box">
        <div class="box-t tanxin">
            <ul class="box-ul tanxin">
                <li>热门推荐</li>
                <li>华语</li>
                <li>流行</li>
                <li>摇滚</li>
                <li>民谣</li>
                <li>电子</li>
            </ul>
            <span class="ul-r">更多 >></span>
        </div>
        <div class="box-c">
            <ul class="HotRe-list tanxin">
                <li v-for="(item,index) in HotSong" :key="index">
                    <div class="hotImg">
                        <img height="140" :src="item.picUrl" alt="">
                        <p class="bottom">
                            <span class="icon-headset"></span>
                            <span class="nb">{{item.playCount}}</span>
                            <span class="play"></span>
                        </p>
                    </div>
                    <p class="title">
                        <a href="">
                            {{item.name}}
                        </a>
                    </p>
                </li>
            </ul>
        </div>
    </div>
</template>

<script>
import { HotSongApi } from '@/request/api'
export default {
    data () {
        return {
            HotSong:[],
        }
    },
    created(){
        HotSongApi().then(res => {
            console.log(res);
            if (res.data.code === 200) {
                this.HotSong = res.data.result.slice(0, 8);
                console.log(this.HotSong);

            }
        })
    }
}
</script>
 
<style lang = "less" scoped>
@import "../../assets/base.less";
.box{
    background-color: #fff !important;
}
.box-t{
    border-bottom: 2px solid brown;
    justify-content: space-between;
    .box-ul{
        li{
            padding: 0 15px;
            margin: 15px 0;
            border-right: 1px solid #000;
            cursor: pointer;
        }
        li:first-child{
            font-size: 20px;
            padding-left: 0;
            border: none;
        }
        li:last-child{
            border: none;
        }
    }
    .ul-r{
        cursor: pointer;
    }
}
.box-c{
    .HotRe-list {
        flex-wrap: wrap;
        margin-top: 20px;
        justify-content: space-between;
        li {
            width: 140px;
            height: 204px;
            margin-right: 20px;
            .hotImg {
                position: relative;
                .bottom {
                    position: absolute;
                    bottom: 0;
                    left: 0;
                    width: 100%;
                    height: 27px;
                    background: rgba(0, 0, 0, 0.5);
                    display: flex;
                    align-items: center;
                    color: #999;
                    justify-content: space-between;
                    padding: 0 10px;
                    box-sizing: border-box;
                    .icon-headset {
                        display: inline-block;
                        width: 14px;
                        height: 11px;
                        background: url('../../assets/images/iconall.png') no-repeat;
                        background-position: 0 -24px;
                    }
                    .nb {
                        margin-left: -30px;
                    }
                    .play {
                        display: inline-block;
                        width: 16px;
                        height: 17px;
                        background: url('../../assets/images/iconall.png') no-repeat;
                        background-position: 0 0;
                    }
                }
            }

            .title {
                margin: 8px 0 3px;
                font-size: 12px;

                a {
                    list-style: none;
                    text-decoration: none;
                    text-align: center;
                    color: #000;
                    display: inline-block;
                    max-width: 100%;
                    vertical-align: middle;
                }
            }
        }
        li:nth-child(4n){
            margin-right: 0;
        }
    }
}
</style>